package com.lu.controller;

import com.lu.pojo.Messages;
import com.lu.service.MessageService;
import com.lu.service.WebSocket;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@CrossOrigin
public class MessageController {


    @Resource
    private MessageService service;

    @PostMapping("/message")
    public Integer insert(@RequestBody Messages messages) {
        return service.insert(messages);
    }

    @PostMapping("/getmessages/{mfromuserid}/{mtouserid}")
    public List<Messages> getMessages(@PathVariable("mfromuserid") int mfromuserid, @PathVariable("mtouserid") int mtouserid) {
        return service.getMessages(mfromuserid, mtouserid);
    }

}
